| 12345678910111213141516171819202122232425262728293031323334 |
- import { notFound } from 'next/navigation';
- import { fetchJson } from '@/lib/utils/server';
- import { fetchUserFeed } from '@/lib/api/account/profile';
- import { ResultDto } from '@/types/response/common';
- import { ChannelDetail } from '@/types/channel';
- import FeedList from '@/app/(main)/feed/_component/FeedList';
- type Props = {
- params: Promise<{ identifier: string }>;
- };
- export default async function ChannelPostsPage({ params }: Props) {
- const { identifier } = await params;
- const chRes: ResultDto<ChannelDetail> = await fetchJson(`/api/channel/${encodeURIComponent(decodeURIComponent(identifier))}`, { method: 'GET' });
- if (!chRes.data) {
- notFound();
- }
- const memberSID = chRes.data.memberSID;
- const feedRes = await fetchUserFeed(memberSID, 1, 20);
- const data = feedRes.data ?? { total: 0, list: [], authorSID: memberSID, authorName: chRes.data.name };
- return (
- <div className="channel-page__tab-content">
- <FeedList
- initialCards={data.list}
- initialTotal={data.total}
- endpoint={`/api/member/${encodeURIComponent(memberSID)}/feed`}
- emptyMessage="작성한 피드가 없습니다."
- />
- </div>
- );
- }
|